package com.bawei.patient.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bawei.common.utils.R;
import com.bawei.patient.vo.DoctorPatientMidVo;
import com.bawei.patient.vo.DoctorPatientSpecificVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.bawei.patient.dao.DoctorPatientMidDao;
import com.bawei.patient.entity.DoctorPatientMidEntity;
import com.bawei.patient.service.DoctorPatientMidService;


@Service("doctorPatientMidService")
public class DoctorPatientMidServiceImpl extends ServiceImpl<DoctorPatientMidDao, DoctorPatientMidEntity> implements DoctorPatientMidService {

    @SuppressWarnings("all")
    @Autowired
    private DoctorPatientMidDao doctorPatientMidDao;

    @Override
    public IPage<DoctorPatientMidEntity> queryPage(Map<String, Object> params) {
        Integer page = Integer.parseInt((String) params.get("page"));
        Integer limit = Integer.parseInt( (String) params.get("limit"));
        Integer patientId = Integer.parseInt((String) params.get("patientId"));


        Page<DoctorPatientMidEntity> doctorPatientMidVoPage = new Page<>(page,limit);

        IPage<DoctorPatientMidEntity> iPage = doctorPatientMidDao.doctorPatientList(doctorPatientMidVoPage,patientId);
        return iPage;
    }

    @Override
    public R findByPatientId(Integer id) {

        DoctorPatientSpecificVo doctorPatientSpecificVo = doctorPatientMidDao.findByPatientId(id);
        return R.ok().put("doctorPatientSpecificVo",doctorPatientSpecificVo);
    }

}